package cn.wen.javax.net.mail.base;

import java.io.File;

import org.apache.commons.mail.Email;
import org.apache.commons.mail.EmailAttachment;

/**
 * Title：邮件辅助类
 * <p>
 * Description：
 * <p>
 * Copyright：Copyright (c) 2010-2012
 * 
 * @author <a href="mailto:ct_wen@qq.com">ctwen</a>, 温承瑭
 * @version Revision：1.0 Date：2012/8/2 Description：初完成。
 *          <p>
 */
public class HelperOfMail {

    /**
     * 将JAVA文件对象转换为邮件附件对象。
     * 
     * @param attach JAVA文件对象
     * @return 邮件附件对象
     */
    public static EmailAttachment getEmailAttachment(File attach) {
	EmailAttachment attachment = new EmailAttachment();
	attachment.setPath(attach.getPath());
	attachment.setName(attach.getName());
	attachment.setDescription(attach.getName());
	attachment.setDisposition(Email.ATTACHMENTS);
	return attachment;
    }

}
